package com.zdd.ehe.controller;

import com.zdd.ehe.neo4j.entity.DiseaseNode;
import com.zdd.ehe.neo4j.service.KnowledgeGraphService;
import com.zdd.ehe.result.Result;
import com.zdd.ehe.vo.KnowledgeGraphVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version 1.0.0
 * @title: GraphController
 * @author: HFLy
 * @description: 知识图谱相关接口
 * @date: 10/3/2023 上午12:38
 */
@Api(tags = "知识图谱")
@RestController
@RequestMapping("/knowledgeGraph")
public class GraphController {

    private KnowledgeGraphService knowledgeGraphService;

    @ApiOperation("知识图谱显示")
    @GetMapping("/show")
    public Result show(){
        KnowledgeGraphVo knowledgeGraph = knowledgeGraphService.getKnowledgeGraph();
        return Result.success("成功",knowledgeGraph);
    }
    @ApiOperation("传输Id，显示节点信息")
    @GetMapping("/queryDisease/{id}")
    public Result queryDisease(@PathVariable(name = "id") Integer id){
        DiseaseNode diseaseNode = knowledgeGraphService. queryDiseaseNodeById(id);
        return Result.success("成功",diseaseNode);
    }
}
